package com.lxy.demo.dao;

import com.lxy.demo.entity.Books;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BooksDao {

    public List<Books> getBooksAll();

    //注解开发
    @Select("select * from books")
    public List<Books> selectBooks();

    public List<Books> findBooksLikeName(String bookName);

    public List<Books> findBooksBySome(@Param("bookName") String bookName,@Param("min") Double min,@Param("max") Double max);

    @Insert("insert into books values(null,#{bookname},#{price},#{num})")
    public int insertBook(Books books);

    //更新数据
    @Update("update books set bookName = #{bookname}, price=#{price}, num=#{num} where id = #{id}")
    public int uptBooks(Books books);

    @Delete("delete from books where id = #{id}")
    public int delBooks(int id);
}
